home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_10.lha / 7_10 / 7_10po.h < prev    next >
C/C++ Source or Header  |  1993-08-08  |  1KB  |  57 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / typedefs to ease some declarations
  6. ypedef void (*PVFPC)(char*);
  7. ypedef void (*PVFV)();
  8.  
  9. / for maintaining a list of processes
  10. lass process_link
  11.  
  12.    friend class process_object;
  13.    process *pl_process;
  14.    process_link *pl_next;
  15.  
  16.    process_link(process *t, process_link *pl)
  17.    { pl_process = t; pl_next = pl; }
  18. ;
  19.  
  20. / The basis of the process system.
  21. lass process_object
  22.  
  23. / protected:
  24. riend class process;
  25. riend class queue_head;
  26. riend class queue_tail;
  27.    process_object *po_next;    // to chain process_objects
  28.    process_link *po_link;    // the process memory
  29.  
  30.    // user-supplied error function
  31.    static void (*po_error_fct)(char*);
  32.  
  33. ublic:
  34.    process_object() { po_next = 0; po_link = 0; }
  35.    ~process_object();
  36.  
  37.    // return T if object is not available yet
  38.    virtual int pending();
  39.  
  40.    // add process to object's memory
  41.    void remember(process *t)
  42.    { po_link = new process_link(t, po_link); }
  43.  
  44.    // reschedule all idle remembered processes
  45.    void alert();
  46.  
  47.    // remove process from object's memory
  48.    void forget(process *);
  49.  
  50.    // main error function
  51.    void error(char*);
  52.  
  53.    // allow user to set po_error_fct
  54.    PVFPC set_error_function(PVFPC);
  55.    virtual ostream &print(ostream&);                // DELETE
  56. ;
  57.